package day05;
import java.util.Scanner;
import java.util.Arrays;
public class Day05HomeWork01 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        //=============================第一题==========================
        int answer;
        int a,b,score=0;
        for (int i=0;i<10;i++){
            a=(int)(Math.random()*10);
            b=(int)(Math.random()*10);
            int mun=a+b;
            System.out.print(a+"+"+b+"=");
            answer=scan.nextInt();
            if(answer==mun){
                System.out.println("恭喜你答对了");
                score+=10;
            }else {
                System.out.println("对不起，答错了");
            }
        }
        System.out.println("总得分："+score+"分");
        //=============================第二题==========================

        int num_1;
        int num_2;
        for(int i=1;i<10;i++){
            num_1=1;
            System.out.println();
            for (num_1=1;num_1<=i;num_1++){
                num_2=num_1*i;
                System.out.print(num_1+"*"+i+"="+num_2+"\t");
            }
        }

        //=============================第三题==========================

        //声明、初始化
        int[] arr1=new int[3];

        int[] arr2={1,2,3};
        int[] arr3=new int[]{1,2,3};
        int[] arr4;
        arr4=new int[]{1,3,4};
        //访问
        System.out.println(arr4[0]);
        //遍历
        for(int i=0;i<arr4.length;i++){
            System.out.println(arr4[i]);
        }

        //=============================第四题==========================
        int[] arr=new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int) (Math.random()*100);
            System.out.println(arr[i]);
        }
        int max=arr[0];
        for (int i=1;i<arr.length;i++){
            if(max<arr[i]){
                max=arr[i];
            }
        }
        System.out.println("最大为："+max);
        //=============================第五题==========================
        int[] arr_1=new int[10];
        for(int i=0;i<arr_1.length;i++){
            arr_1[i]=(int)(Math.random()*100);
        }
        Arrays.sort(arr_1);
        for(int i=0;i<arr_1.length;i++){
            System.out.println(arr_1[i]);
        }


    }
}
